package shuai.biz;

import org.springframework.stereotype.Component;

import shuai.util.OutOfStockException;
@Component
public class PhoneBizImpl implements PhoneBiz {
	int num;
	public void buyPhone(int num) {
		
		System.out.println("手机进货，进货数量为："+num+"部");
		this.num=num;
	}

	public void salePhone(int num) throws OutOfStockException {
		if(this.num<num)
			throw new OutOfStockException("库存不足，需要"+num+"库存只有"+this.num+"部");
		System.out.println("手机销售，销售数量为："+num+"部");

	}

}
